import { lists } from '../services/Personalinformation';


export default {

  namespace: 'mine',

  state: {

  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(({pathname, query}) => {
        if (pathname.toString() == "/selfinfo") {
          dispatch({type: 'selfinfo'});
        }
      })
    }
  },

  effects: {
    //我的   首页进来的数据
    *getPersonInfo({payload}, { call, put, select }) {
      const data = yield call(lists, {code:"U707517560978935987",relation:["org","extend","infos"]});
      const position=data.data.ret.type;
      const lv= '25';

      yield put({
        type: 'success',
        payload: {
          name:data.data.ret.name,
          position:position,
          lv:lv,
        }
      })
    },

    //个人详情
    *selfinfo({payload}, { call, put, select }) {

      console.log('个人详情')

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

  },

  reducers: {
    success(state, action){
      return {...state, ...action.payload};
    }
  }
};
